package com.baizhi.jishi.controller;

import com.baizhi.jishi.entity.Patient;
import com.baizhi.jishi.service.PatientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

@Controller
@RequestMapping("/patient")
public class PatientController {
    @Autowired
    private PatientService patientService;
    @RequestMapping("/showPage")
    @ResponseBody
    public Map showPage(int page,int limit,String patientname){
        //System.out.println(patientname);
        return patientService.showPage(page, limit, patientname);
    }
    @RequestMapping("/addPatient")
    @ResponseBody
    public Map addPatient(Patient patient){
        //System.out.println(patient);
        return patientService.addPatient(patient);
    }
    @RequestMapping("/deletePatient")
    @ResponseBody
    public Map deletePatient(int id){
        return patientService.deletePatient(id);
    }
    @RequestMapping("/selectOne")
    @ResponseBody
    public Map selectOne(int id){
        return patientService.selectOne(id);
    }
    @RequestMapping("/updatePatient")
    @ResponseBody
    public Map updatePatient(Patient patient){
        return patientService.updatePatient(patient);
    }
    @RequestMapping("/deleteSome")
    @ResponseBody
    public Map deleteSome(int[] ids){
        return patientService.deleteSome(ids);
    }
}
